public class KthToLast{
  public void kthToLast(Node n, int k) {
    Node head = n;
    Node pivot = head;
    
    for(int i = 0; i < k-1; i++) {
      if(pivot == null) return;
      pivot = pivot.next;
    }
    
    if(pivot == null) return;
    
    while(pivot != null) {
      System.out.println(pivot.data);
      pivot = pivot.next;
    }
    return;
  }
}